from flask import render_template

from app.models.gift import Gift
from app.view_models.book import BookViewModel
from . import web


__author__ = '七月'


# def __current_user_status_change():
#     r = request


@web.route('/')
# @cache.cached(timeout=100, unless=__current_user_status_change)
# @cache.cached(timeout=100)
def index():
    recent_gifts = Gift.recent()
    books = [BookViewModel(gift.book) for gift in recent_gifts]
    return render_template('index.html', recent = books)
    return "index page !"

@web.route('/personal')
def personal_center():
    pass

